<template>
  <!-- 物流检测模板 2018/3/7 11:44 zhangQ -->
  <div>
    <Tabs v-model="tabParam.status">
      <template v-for="item in orderStatues">
        <TabPane :label="item.label" :name="item.val"></TabPane>
      </template>
    </Tabs>

    <tablePage ref="inspectionTab" :api="getMainOrderByPage" :sortName="sortName" :param="tabParam" :isStartLoad="true">
      <template slot-scope="props">
        <Table :columns="inspectionColumn" :data="props.data" @on-sort-change="props.sortChange" border></Table>
      </template>
    </tablePage>
  </div>
</template>

<script>
  import tablePage from '@components/table/tablePage.vue'
  import { getMainOrderByPage } from '@api/backEnd/mainOrder'

  export default {
    name: 'base-inspection',
    data () {
      let datas = { getMainOrderByPage }
      return datas
    },
    props: {
      sortName: {
        type: String,
        default: ''
      },
      /**
       * 主运单状态
       * @auther zhangQ
       * @date 2018/3/15 18:13
       **/
      orderStatues: {
        type: Array,
        default () {
          return []
        }
      },
      /**
       * 表格行
       * @auther zhangQ
       * @date 2018/3/15 18:14
       **/
      inspectionColumn: {
        type: Array,
        default () {
          return []
        }
      },
      /**
       * 查询参数
       * @auther zhangQ
       * @date 2018/3/15 18:14
       **/
      tabParam: {
        type: Object,
        default () {
          return {}
        }
      }
    },
    computed: {},
    methods: {
      /**
       * TODO(数据刷新)
       * @auther zhangQ
       * @date 2018/3/19 16:41
       */
      dataRefresh () {
        this.$refs['inspectionTab'].dataRefresh()
      }
    },
    watch: {
      'tabParam.status': function (val, oldval) {
        this.$refs['inspectionTab'].dataRefresh()
      }
    },
    created () {
    },
    mounted () {
    },
    components: { tablePage }
  }
</script>

<style>
  .columnAuto {
    min-width: 250px;
  }
</style>
